import { ApiProperty } from "@nestjs/swagger";
import {Column,Entity,ManyToOne,PrimaryGeneratedColumn} from 'typeorm'
import {User} from '../../user/entities/user.entity'

export enum TodoStatus{
    TODO = 0, 
    DONE = 1,
}

@Entity()
export class Todo {
    @ApiProperty()
    @PrimaryGeneratedColumn()
    id:number;

    @ApiProperty()
    @Column({length:500})
    title:string;

    @ApiProperty()
    @Column('text')
    description?:string;

    @ApiProperty()
    @Column('int',{default:TodoStatus.TODO})
    status:TodoStatus

    @ApiProperty({required:false})
    @Column('text')
    media?:string;

    @ManyToOne(()=>User,(user)=>user.todos)
    author:User;
}
